<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class TAquacultureMonth extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('t_aquaculture_month', function (Blueprint $table) {
             $table->engine = 'InnoDB';
             $table->charset = 'utf8mb4';
             $table->collation = 'utf8mb4_unicode_ci';
            // CONTENT
            $table->integer('site_id')->nullable(false)->comment('站点编号');
			$table->integer('pdi_index')->nullable(false)->comment('设备编号');
			$table->date('at_date')->nullable(false)->comment('日期');
			$table->integer('company_id')->nullable(false)->comment('公司编号');
			$table->decimal('DO', 9, 2)->nullable(false)->default(0)->comment('溶解氧');
			$table->decimal('WTH', 9, 2)->nullable(false)->default(0)->comment('水温');
			$table->decimal('PH', 9, 2)->nullable(false)->default(0)->comment('酸碱度');
			$table->decimal('IT', 9, 2)->nullable(false)->default(0)->comment('浊度');
			$table->decimal('WL', 9, 2)->nullable(false)->default(0)->comment('水位');
			$table->decimal('NH4', 9, 2)->nullable(false)->default(0)->comment('氨氮');
			$table->decimal('RC', 9, 2)->nullable(false)->default(0)->comment('余氯');
			$table->decimal('Flow', 9, 2)->nullable(false)->default(0)->comment('水流量');
			$table->decimal('AllFlow', 9, 2)->nullable(false)->default(0)->comment('累计水流量');
			$table->integer('num')->nullable()->default(0)->comment('次数');
			$table->primary(['site_id','pdi_index','at_date']);
			
        });

        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('t_aquaculture_month');
    }
}
